using System;
using System.Collections.Generic;
using System.Text;

namespace Barbar.MapReport.PolygonReducer {
  internal class Point : IComparable<Point> {
    private decimal m_X;
    private decimal m_Y;
    private decimal m_Z;

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    public decimal X {
      get { return m_X; }
      set { m_Y = value; }
    }

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    public decimal Y {
      get { return m_Y; }
      set { m_Y = value; }
    }

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    public decimal Z {
      get { return m_Z;}
      set { m_Z = value; }
    }

    public Point(decimal x, decimal y, decimal z) {
      m_X = x;
      m_Y = y;
      m_Z = z;
    }

    public static Vector operator -(Point a, Point b) {
      return new Vector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
    }

    public static Point operator +(Point a, Vector b) {
      return new Point(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
    }

    #region IComparable<Point> Members

    public int CompareTo(Point other) {
      if (X == other.X) {
        if (Y == other.Y) {
          return Z.CompareTo(other.Z);
        }
        return Y.CompareTo(other.Y);
      }
      return X.CompareTo(other.X);
    }

    #endregion
  }
}
